package com.remoting.core.registry;

import com.remoting.api.registry.ServiceImportRegistry;
import com.remoting.api.registry.bean.Endpoint;
import com.remoting.api.registry.bean.HeaderInfo;
import com.remoting.api.registry.bean.ServiceImportInfo;

import java.util.HashMap;
import java.util.Map;


/**
 * 远程服务导入注册接口实现
 * <p>说明:</p>
 * <li></li>
 * @author DuanYong
 * @since 2017年3月3日上午10:03:46
 */
public class DefaultServiceImportRegistry implements ServiceImportRegistry {
	/**服务信息*/
	private Map<String, ServiceImportInfo> serviceInfoMap = new HashMap<String, ServiceImportInfo>();
	/**端点信息*/
	private Map<String, Endpoint> endpointMap = new HashMap<String, Endpoint>();
	/**请求头信息*/
	private Map<String, HeaderInfo> headerInfoMap = new HashMap<String, HeaderInfo>();
	
    @Override
	public void addServiceImportInfo(ServiceImportInfo serviceInfo) {
		serviceInfoMap.put(serviceInfo.getServiceId(), serviceInfo);
	}
    @Override
	public ServiceImportInfo getServiceImportInfo(String id) {
		return serviceInfoMap.get(id);
	}
    @Override
	public void addEndpoint(Endpoint endpoint) {
		this.endpointMap.put(endpoint.getId(), endpoint);
	}
    @Override
	public Endpoint getEndpoint(String id) {
		return this.endpointMap.get(id);
	}
	@Override
	public HeaderInfo getHeader(String id) {
		return this.headerInfoMap.get(id);
	}
	@Override
	public void addHeader(HeaderInfo headerInfo) {
		this.headerInfoMap.put(headerInfo.getId(), headerInfo);
	}

}
